/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author java
 */
@Entity
@Table(name = "NAMES")
@NamedQueries({
    @NamedQuery(name = "Name.findAll", query = "SELECT n FROM Name n"),
    @NamedQuery(name = "Name.findById", query = "SELECT n FROM Name n WHERE n.id = :id"),
    @NamedQuery(name = "Name.findByCode", query = "SELECT n FROM Name n WHERE n.code = :code"),
    @NamedQuery(name = "Name.findByCode2", query = "SELECT n FROM Name n WHERE n.code2 = :code2"),
    @NamedQuery(name = "Name.findByNameTypeId", query = "SELECT n FROM Name n WHERE n.nameTypeId = :nameTypeId"),
    @NamedQuery(name = "Name.findByName", query = "SELECT n FROM Name n WHERE n.name = :name"),
    @NamedQuery(name = "Name.findByCompanyId", query = "SELECT n FROM Name n WHERE n.companyId = :companyId"),
    @NamedQuery(name = "Name.findByPersonalIdNumber", query = "SELECT n FROM Name n WHERE n.personalIdNumber = :personalIdNumber"),
    @NamedQuery(name = "Name.findByAddress", query = "SELECT n FROM Name n WHERE n.address = :address"),
    @NamedQuery(name = "Name.findByWorkAddress", query = "SELECT n FROM Name n WHERE n.workAddress = :workAddress"),
    @NamedQuery(name = "Name.findByTelWork", query = "SELECT n FROM Name n WHERE n.telWork = :telWork"),
    @NamedQuery(name = "Name.findByTelHome", query = "SELECT n FROM Name n WHERE n.telHome = :telHome"),
    @NamedQuery(name = "Name.findByTelMobile", query = "SELECT n FROM Name n WHERE n.telMobile = :telMobile"),
    @NamedQuery(name = "Name.findByTelFax", query = "SELECT n FROM Name n WHERE n.telFax = :telFax"),
    @NamedQuery(name = "Name.findByDirector", query = "SELECT n FROM Name n WHERE n.director = :director"),
    @NamedQuery(name = "Name.findByDealer", query = "SELECT n FROM Name n WHERE n.dealer = :dealer"),
    @NamedQuery(name = "Name.findByQualifications", query = "SELECT n FROM Name n WHERE n.qualifications = :qualifications"),
    @NamedQuery(name = "Name.findByLimit", query = "SELECT n FROM Name n WHERE n.limit = :limit"),
    @NamedQuery(name = "Name.findByNote", query = "SELECT n FROM Name n WHERE n.note = :note"),
    @NamedQuery(name = "Name.findByAccountId", query = "SELECT n FROM Name n WHERE n.accountId = :accountId"),
    @NamedQuery(name = "Name.findByNameStatusId", query = "SELECT n FROM Name n WHERE n.nameStatusId = :nameStatusId"),
    @NamedQuery(name = "Name.findByBirthDate", query = "SELECT n FROM Name n WHERE n.birthDate = :birthDate"),
    @NamedQuery(name = "Name.findByGraduationDate", query = "SELECT n FROM Name n WHERE n.graduationDate = :graduationDate"),
    @NamedQuery(name = "Name.findByMembershipDate", query = "SELECT n FROM Name n WHERE n.membershipDate = :membershipDate"),
    @NamedQuery(name = "Name.findByWorkLocation", query = "SELECT n FROM Name n WHERE n.workLocation = :workLocation"),
    @NamedQuery(name = "Name.findByEmail", query = "SELECT n FROM Name n WHERE n.email = :email"),
    @NamedQuery(name = "Name.findByRegion", query = "SELECT n FROM Name n WHERE n.region = :region"),
    @NamedQuery(name = "Name.findByGraduation", query = "SELECT n FROM Name n WHERE n.graduation = :graduation"),
    @NamedQuery(name = "Name.findByReligion", query = "SELECT n FROM Name n WHERE n.religion = :religion"),
    @NamedQuery(name = "Name.findByGender", query = "SELECT n FROM Name n WHERE n.gender = :gender"),
    @NamedQuery(name = "Name.findByMaritalStatus", query = "SELECT n FROM Name n WHERE n.maritalStatus = :maritalStatus"),
    @NamedQuery(name = "Name.findByNationality", query = "SELECT n FROM Name n WHERE n.nationality = :nationality"),
    @NamedQuery(name = "Name.findBySalesTaxRegistered", query = "SELECT n FROM Name n WHERE n.salesTaxRegistered = :salesTaxRegistered"),
    @NamedQuery(name = "Name.findBySalesTaxRegisterationNo", query = "SELECT n FROM Name n WHERE n.salesTaxRegisterationNo = :salesTaxRegisterationNo"),
    @NamedQuery(name = "Name.findByInitialLastPaidYear", query = "SELECT n FROM Name n WHERE n.initialLastPaidYear = :initialLastPaidYear"),
    @NamedQuery(name = "Name.findByLicenseNumber", query = "SELECT n FROM Name n WHERE n.licenseNumber = :licenseNumber"),
    @NamedQuery(name = "Name.findByUserDefinedField1", query = "SELECT n FROM Name n WHERE n.userDefinedField1 = :userDefinedField1"),
    @NamedQuery(name = "Name.findByUserDefinedField2", query = "SELECT n FROM Name n WHERE n.userDefinedField2 = :userDefinedField2"),
    @NamedQuery(name = "Name.findByUserDefinedField3", query = "SELECT n FROM Name n WHERE n.userDefinedField3 = :userDefinedField3"),
    @NamedQuery(name = "Name.findByUserDefinedField4", query = "SELECT n FROM Name n WHERE n.userDefinedField4 = :userDefinedField4"),
    @NamedQuery(name = "Name.findByUserDefinedField5", query = "SELECT n FROM Name n WHERE n.userDefinedField5 = :userDefinedField5"),
    @NamedQuery(name = "Name.findByUserDefinedField6", query = "SELECT n FROM Name n WHERE n.userDefinedField6 = :userDefinedField6"),
    @NamedQuery(name = "Name.findByUserDefinedField7", query = "SELECT n FROM Name n WHERE n.userDefinedField7 = :userDefinedField7"),
    @NamedQuery(name = "Name.findByUserDefinedField8", query = "SELECT n FROM Name n WHERE n.userDefinedField8 = :userDefinedField8"),
    @NamedQuery(name = "Name.findByUserDefinedField9", query = "SELECT n FROM Name n WHERE n.userDefinedField9 = :userDefinedField9"),
    @NamedQuery(name = "Name.findByUserDefinedField10", query = "SELECT n FROM Name n WHERE n.userDefinedField10 = :userDefinedField10"),
    @NamedQuery(name = "Name.findByPricingMode", query = "SELECT n FROM Name n WHERE n.pricingMode = :pricingMode")})

public class Name implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Integer id;
    
    @Size(max = 20)
    @Column(name = "CODE")
    private String code;
    
    @Size(max = 20)
    @Column(name = "CODE2")
    private String code2;
    
    @Column(name = "NAME_TYPE_ID")
    private Integer nameTypeId;
    
    @Size(max = 50)
    @Column(name = "NAME")
    private String name;
    
    @Column(name = "COMPANY_ID")
    private Integer companyId;
    
    @Size(max = 20)
    @Column(name = "PERSONAL_ID_NUMBER")
    private String personalIdNumber;
    
    @Size(max = 50)
    @Column(name = "ADDRESS")
    private String address;
    
    @Size(max = 50)
    @Column(name = "WORK_ADDRESS")
    private String workAddress;
    
    @Size(max = 20)
    @Column(name = "TEL_WORK")
    private String telWork;
    
    @Size(max = 20)
    @Column(name = "TEL_HOME")
    private String telHome;
    
    @Size(max = 20)
    @Column(name = "TEL_MOBILE")
    private String telMobile;
    
    @Size(max = 20)
    @Column(name = "TEL_FAX")
    private String telFax;
    
    @Size(max = 50)
    @Column(name = "DIRECTOR")
    private String director;
    
    @Size(max = 50)
    @Column(name = "DEALER")
    private String dealer;
    
    @Size(max = 50)
    @Column(name = "QUALIFICATIONS")
    private String qualifications;
    
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "LIMIT")
    private Double limit;
    
    @Size(max = 200)
    @Column(name = "NOTE")
    private String note;
    
    @Column(name = "ACCOUNT_ID")
    private Integer accountId;
    
    @Column(name = "NAME_STATUS_ID")
    private Integer nameStatusId;
    
    @Column(name = "BIRTH_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date birthDate;
    
    @Column(name = "GRADUATION_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date graduationDate;
    
    @Column(name = "MEMBERSHIP_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date membershipDate;
    
    @Size(max = 50)
    @Column(name = "WORK_LOCATION")
    private String workLocation;
    
    // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
    @Size(max = 20)
    @Column(name = "EMAIL")
    private String email;
    
    @Size(max = 50)
    @Column(name = "REGION")
    private String region;
    
    @Size(max = 50)
    @Column(name = "GRADUATION")
    private String graduation;
    
    @Column(name = "RELIGION")
    private Integer religion;
    
    @Column(name = "GENDER")
    private Integer gender;
    
    @Column(name = "MARITAL_STATUS")
    private Integer maritalStatus;
    
    @Size(max = 20)
    @Column(name = "NATIONALITY")
    private String nationality;
    
    @Column(name = "SALES_TAX_REGISTERED")
    private Character salesTaxRegistered;
    
    @Size(max = 50)
    @Column(name = "SALES_TAX_REGISTERATION_NO")
    private String salesTaxRegisterationNo;
    
    @Column(name = "INITIAL_LAST_PAID_YEAR")
    private Integer initialLastPaidYear;
    
    @Size(max = 20)
    @Column(name = "LICENSE_NUMBER")
    private String licenseNumber;
    
    @Column(name = "USER_DEFINED_FIELD1")
    private Integer userDefinedField1;
    
    @Column(name = "USER_DEFINED_FIELD2")
    private Integer userDefinedField2;
    
    @Column(name = "USER_DEFINED_FIELD3")
    private Integer userDefinedField3;
    
    @Column(name = "USER_DEFINED_FIELD4")
    private Integer userDefinedField4;
    
    @Column(name = "USER_DEFINED_FIELD5")
    private Integer userDefinedField5;
    
    @Column(name = "USER_DEFINED_FIELD6")
    private Integer userDefinedField6;
    
    @Size(max = 50)
    @Column(name = "USER_DEFINED_FIELD7")
    private String userDefinedField7;
    
    @Size(max = 50)
    @Column(name = "USER_DEFINED_FIELD8")
    private String userDefinedField8;
    
    @Size(max = 50)
    @Column(name = "USER_DEFINED_FIELD9")
    private String userDefinedField9;
    
    @Size(max = 50)
    @Column(name = "USER_DEFINED_FIELD10")
    private String userDefinedField10;
    
    @Column(name = "PRICING_MODE")
    private Integer pricingMode;
    
    @OneToMany(mappedBy = "nameId", fetch = FetchType.LAZY)
    private Set<Sale> saleList;
    

    public Name() {
    }

    public Name(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getCode2() {
        return code2;
    }

    public void setCode2(String code2) {
        this.code2 = code2;
    }

    public Integer getNameTypeId() {
        return nameTypeId;
    }

    public void setNameTypeId(Integer nameTypeId) {
        this.nameTypeId = nameTypeId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Integer companyId) {
        this.companyId = companyId;
    }

    public String getPersonalIdNumber() {
        return personalIdNumber;
    }

    public void setPersonalIdNumber(String personalIdNumber) {
        this.personalIdNumber = personalIdNumber;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getWorkAddress() {
        return workAddress;
    }

    public void setWorkAddress(String workAddress) {
        this.workAddress = workAddress;
    }

    public String getTelWork() {
        return telWork;
    }

    public void setTelWork(String telWork) {
        this.telWork = telWork;
    }

    public String getTelHome() {
        return telHome;
    }

    public void setTelHome(String telHome) {
        this.telHome = telHome;
    }

    public String getTelMobile() {
        return telMobile;
    }

    public void setTelMobile(String telMobile) {
        this.telMobile = telMobile;
    }

    public String getTelFax() {
        return telFax;
    }

    public void setTelFax(String telFax) {
        this.telFax = telFax;
    }

    public String getDirector() {
        return director;
    }

    public void setDirector(String director) {
        this.director = director;
    }

    public String getDealer() {
        return dealer;
    }

    public void setDealer(String dealer) {
        this.dealer = dealer;
    }

    public String getQualifications() {
        return qualifications;
    }

    public void setQualifications(String qualifications) {
        this.qualifications = qualifications;
    }

    public Double getLimit() {
        return limit;
    }

    public void setLimit(Double limit) {
        this.limit = limit;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public Integer getAccountId() {
        return accountId;
    }

    public void setAccountId(Integer accountId) {
        this.accountId = accountId;
    }

    public Integer getNameStatusId() {
        return nameStatusId;
    }

    public void setNameStatusId(Integer nameStatusId) {
        this.nameStatusId = nameStatusId;
    }

    public Date getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    public Date getGraduationDate() {
        return graduationDate;
    }

    public void setGraduationDate(Date graduationDate) {
        this.graduationDate = graduationDate;
    }

    public Date getMembershipDate() {
        return membershipDate;
    }

    public void setMembershipDate(Date membershipDate) {
        this.membershipDate = membershipDate;
    }

    public String getWorkLocation() {
        return workLocation;
    }

    public void setWorkLocation(String workLocation) {
        this.workLocation = workLocation;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getGraduation() {
        return graduation;
    }

    public void setGraduation(String graduation) {
        this.graduation = graduation;
    }

    public Integer getReligion() {
        return religion;
    }

    public void setReligion(Integer religion) {
        this.religion = religion;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public Integer getMaritalStatus() {
        return maritalStatus;
    }

    public void setMaritalStatus(Integer maritalStatus) {
        this.maritalStatus = maritalStatus;
    }

    public String getNationality() {
        return nationality;
    }

    public void setNationality(String nationality) {
        this.nationality = nationality;
    }

    public Character getSalesTaxRegistered() {
        return salesTaxRegistered;
    }

    public void setSalesTaxRegistered(Character salesTaxRegistered) {
        this.salesTaxRegistered = salesTaxRegistered;
    }

    public String getSalesTaxRegisterationNo() {
        return salesTaxRegisterationNo;
    }

    public void setSalesTaxRegisterationNo(String salesTaxRegisterationNo) {
        this.salesTaxRegisterationNo = salesTaxRegisterationNo;
    }

    public Integer getInitialLastPaidYear() {
        return initialLastPaidYear;
    }

    public void setInitialLastPaidYear(Integer initialLastPaidYear) {
        this.initialLastPaidYear = initialLastPaidYear;
    }

    public String getLicenseNumber() {
        return licenseNumber;
    }

    public void setLicenseNumber(String licenseNumber) {
        this.licenseNumber = licenseNumber;
    }

    public Integer getUserDefinedField1() {
        return userDefinedField1;
    }

    public void setUserDefinedField1(Integer userDefinedField1) {
        this.userDefinedField1 = userDefinedField1;
    }

    public Integer getUserDefinedField2() {
        return userDefinedField2;
    }

    public void setUserDefinedField2(Integer userDefinedField2) {
        this.userDefinedField2 = userDefinedField2;
    }

    public Integer getUserDefinedField3() {
        return userDefinedField3;
    }

    public void setUserDefinedField3(Integer userDefinedField3) {
        this.userDefinedField3 = userDefinedField3;
    }

    public Integer getUserDefinedField4() {
        return userDefinedField4;
    }

    public void setUserDefinedField4(Integer userDefinedField4) {
        this.userDefinedField4 = userDefinedField4;
    }

    public Integer getUserDefinedField5() {
        return userDefinedField5;
    }

    public void setUserDefinedField5(Integer userDefinedField5) {
        this.userDefinedField5 = userDefinedField5;
    }

    public Integer getUserDefinedField6() {
        return userDefinedField6;
    }

    public void setUserDefinedField6(Integer userDefinedField6) {
        this.userDefinedField6 = userDefinedField6;
    }

    public String getUserDefinedField7() {
        return userDefinedField7;
    }

    public void setUserDefinedField7(String userDefinedField7) {
        this.userDefinedField7 = userDefinedField7;
    }

    public String getUserDefinedField8() {
        return userDefinedField8;
    }

    public void setUserDefinedField8(String userDefinedField8) {
        this.userDefinedField8 = userDefinedField8;
    }

    public String getUserDefinedField9() {
        return userDefinedField9;
    }

    public void setUserDefinedField9(String userDefinedField9) {
        this.userDefinedField9 = userDefinedField9;
    }

    public String getUserDefinedField10() {
        return userDefinedField10;
    }

    public void setUserDefinedField10(String userDefinedField10) {
        this.userDefinedField10 = userDefinedField10;
    }

    public Integer getPricingMode() {
        return pricingMode;
    }

    public void setPricingMode(Integer pricingMode) {
        this.pricingMode = pricingMode;
    }

    public Set<Sale> getSaleList() {
        return saleList;
    }

    public void setSaleList(Set<Sale> saleList) {
        this.saleList = saleList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Name)) {
            return false;
        }
        Name other = (Name) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Name[ id=" + id + " ]";
    }
    
}
